#include <cstdio>
#include <vector>
using namespace std;

template<typename T>
void Aswap(T &x, T &y) {
	T t;
	t = x;
	x = y;
	y = t;
} 

template<class T>
class p_queue {
	std::vector<T> s;
	unsigned head;
	public:
	p_queue() {
		head = 0;
		T x;
		s.push_back(x);
	}
	
	void push(T dt) {
		s.push_back(dt);
		unsigned np = s.size() - 1;
		unsigned x;
		while (np > 1 + head) {
			x = (np - head) / 2 + head;
			if (s[x] > s[np]) {
				Aswap(s[np], s[x]);
				Aswap(np, x);
				if (x % 2 == head % 2) {
					if (s[x] > s[x+1]) Aswap(s[x], s[x+1]);
				} else {
					if (s[x] < s[x+1]) Aswap(s[x], s[x+1]);
				}
			} else {
				break;
			}
		}
		if (np != 1 + head) {
			if (np % 2 == head % 2) {
				if (s[np] > s[np+1]) {
					Aswap(s[np], s[np+1]);
				}
			} else {
				if (s[np] < s[np-1] && np - 1 < s.size()) {
					Aswap(s[np], s[np-1]);
				}
			}
		}
		return ;
	}

	bool empty() {
		return (s.size() - head - 1) == 0;
	}

	T top() {
		if (this->empty()) {
			throw 1;
		}
		return s[head+1];
	}
	
	T pop() {
		if (this->empty()) {
			throw 1;
		}
		return s[++head];
	}
	
	unsigned size() {
		return s.size() - head - 1;
	}

	std::vector<T>* get_list() {
		return &s;
	}

	unsigned get_head() {
		return head;
	}
};

p_queue<int> q;
int a, n;
int x;
int last;
 
int main() {
    scanf("%d %d", &a, &n);
    q.push(a);
    for (int i = 1; i <= n; ++i) {
        x = q.pop();
        printf("x=%d\n", x);
        if (last == x) {
            --i;
            continue;
        }
        q.push(x*2+1);
        q.push(x*3+1);
        last = x;
        vector<int> l = *(q.get_list());
        unsigned y = q.get_head();
        for (int j = 1; j <= y; ++j) {printf("%d ", l[j]);}
        printf("| ");
		for (int j = y + 1; j < l.size(); ++j) {printf("%d ", l[j]);}
		printf("\n");
    }
    printf("\n");
    printf("%d\n", x);
    return 0;
}

